package com.fulu.designmode.behaviour.strategy_pattern;

/**
 * 步骤3： 定义Context类用于接收和执行不同的策略
 */
public class Context {
    private Strategy strategy;

    public Context(Strategy strategy){
        this.strategy = strategy;
    }

    /**
     * 执行策略
     * @param a
     * @param b
     * @return
     */
    public int executeStrategy(int a, int b){
        return strategy.doOperation(a, b);
    }
}
